package service.impl;

import java.util.List;

import pojo.Merchant;
import pojo.MerchantClient;
import pojo.MerchantDto;
import service.MerchantManager;
import dao.MerchantDao;
import dao.factory.DaoFactory;

public class MerchantManagerImpl implements MerchantManager {
	
	private MerchantDao merchantDao;
	
	public MerchantManagerImpl(){
		merchantDao = DaoFactory.getMerchantDaoInstance();
	}
	
	@Override
	public List<Merchant> getAllMechant() {
		return merchantDao.findAll();
	}

	@Override
	public Merchant getWarehouse(String id) {
		return merchantDao.load(id);
	}

	public List<MerchantClient> getMerchantByType(String type,List<MerchantDto> correctMerchants) {
		return merchantDao.findByType(type, correctMerchants);
	}


	@Override
	public int getCount(String type, List<MerchantDto> correctMerchants) {
		return merchantDao.getCount(type,correctMerchants);
	}

	@Override
	public List<Merchant> selectPage(int current, int pageSize) {
		return merchantDao.selectPage(current, pageSize);
	}

	@Override
	public List<MerchantClient> findByTypePage(int current, int pageSize,
											   String type, List<MerchantDto> correctMerchants) {
		return merchantDao.findByTypePage(current, pageSize, type, correctMerchants);
	}

}
